package utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * Helper class for MD5 Encryption of the password
 * 
 */
public final class MD5Helper {

	/**
	 * Encodes the string into MD5 Hash
	 * 
	 * @param s
	 *            Input string
	 * @return MD5 Hashed string
	 */
	public static final String computeMd5Hash(String s) {
		MessageDigest md = null;
		try {
			md = MessageDigest.getInstance("MD5");
			md.update(s.getBytes(), 0, s.length());
		} catch (NoSuchAlgorithmException exc) {
		}
		return new BigInteger(1, md.digest()).toString(16);
	}

}
